import { getUserCount, getUserList, } from "../../request/api";

let state = {
    // 管理员数据总数
    userCount: {
        total: 0,
    },
}

let mutations = {
    modifyUserCount(state, value) {
        state.userCount.total = value
    }
}

let actions = {
    // 获取管理员数据总数
    getUserCountData(context) {
        getUserCount().then(
            (res) => {
                if (res.data.code == 200) {
                    context.commit("modifyUserCount", res.data.list[0].total)
                }
            },
            (err) => err
        );
    },
}

let getters = {
    userCount(state){
        console.log(state);
        return state.userCount
    }
}

export default {
    state,
    mutations,
    actions,
    getters,
    // 开启命名空间,防止重名
    namespaced: true
}